package com.lkqm.seckill.dictionary;

import com.sun.istack.internal.Nullable;

/**
 * 秒杀装填字典
 * Created by luokaiqiongmou on 2016/11/27.
 */
public enum SeckillStateEnum {

    SUCCESS(0, "秒杀成功"),
    REPEAT_SECKILL(1, "重复秒杀"),
    CLOSED_SECKILL(2, "秒杀已经关闭"),
    DATA_REWRITE(-1, "系统数据重写");


    private int state;
    private String stateInfo;


    SeckillStateEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public int getState() {
        return state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public static SeckillStateEnum stateOf(int index) {
        for (SeckillStateEnum state : values()) {
            if (state.getState() == index) {
                return state;
            }
        }
        return null;
    }

}
